package tests.pojos;

public class BankAccount {
	String accountName;
	double balance;

	public BankAccount(String accountName, double balance) {
		this.accountName = accountName;
		this.balance = balance;
	}

	public double deposit(double funds) {
		balance = balance + funds;
		return balance;
	}

	public double withdraw(double ammount) throws InsufficientFundsException {
		if (balance - ammount >= 0) {
			balance = balance - ammount;
		} else {
			throw new InsufficientFundsException();
		}

		return balance;
	}
	
	public boolean sufficientFunds(double withdrawAmmount){
		if(balance - withdrawAmmount >= 0){
			return true;
		}else{
			return false;
		}
	}
}
